package io.kiki.sba.registry.store.jdbc.domain;

import io.kiki.sba.registry.store.api.meta.DbEntry;
import io.kiki.sba.registry.util.MessageDigests;

import java.sql.Timestamp;


public class InterfaceAppsIndexDomain implements DbEntry {

    /**
     * primary key
     */
    private long id;

    /**
     * local data center
     */
    private String dataCenter;

    /**
     * interfaceName
     */
    private String interfaceName;

    /**
     * appName
     */
    private String appName;

    /**
     * reference
     */
    private boolean reference;

    /**
     * hashcode
     */
    private String hashcode;

    /**
     * create time
     */
    private Timestamp gmtCreate;

    /**
     * last update time
     */
    private Timestamp gmtModify;

    public InterfaceAppsIndexDomain() {
    }

    public InterfaceAppsIndexDomain(String dataCenter, String interfaceName, String appName) {
        this.dataCenter = dataCenter;
        this.interfaceName = interfaceName;
        this.appName = appName;
        this.reference = true;
        // uk: dataCenter + appName + 32char
        this.hashcode = MessageDigests.getMd5String(interfaceName);
    }


    public long getId() {
        return id;
    }


    public void setId(long id) {
        this.id = id;
    }


    public String getDataCenter() {
        return dataCenter;
    }


    public void setDataCenter(String dataCenter) {
        this.dataCenter = dataCenter;
    }


    public String getInterfaceName() {
        return interfaceName;
    }


    public void setInterfaceName(String interfaceName) {
        this.interfaceName = interfaceName;
    }


    public String getAppName() {
        return appName;
    }


    public void setAppName(String appName) {
        this.appName = appName;
    }

    public boolean isReference() {
        return reference;
    }


    public void setReference(boolean reference) {
        this.reference = reference;
    }


    public Timestamp getGmtCreate() {
        return gmtCreate;
    }


    public void setGmtCreate(Timestamp gmtCreate) {
        this.gmtCreate = gmtCreate;
    }


    public Timestamp getGmtModify() {
        return gmtModify;
    }


    public void setGmtModify(Timestamp gmtModify) {
        this.gmtModify = gmtModify;
    }


    public String getHashcode() {
        return hashcode;
    }


    public void setHashcode(String hashcode) {
        this.hashcode = hashcode;
    }


}
